<?
        $results = array();
        require_once('../inc/Addresses.php');
        if(isset($_POST['id']))
        {
                $results = DeleteAddress($_POST['id']);
                header("Location: index.php?deleted=$_POST[id]");
                die();
        }else{
			 	$id = intval($_REQUEST["id"]);
                $results = GetAddress($id);
				$row = mysql_fetch_assoc($results);
        }
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Details of Address: <?=$row['address']?> <?=$row['city']?><?=$row['state']?><?=$row['zip']?></title>
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
    <style type="text/css" >
        .error { color: red; }
                input.error { border-color: red; }
    </style>
</head>

<body>
        <? include('../inc/header.php'); ?>
        <div class="container">
                        <? include('../inc/nav.php'); ?>
            <div id="contents">
               
                <dl class="error">
                        <? foreach ($row as $key => $value): ?>
                                                <dt><?=$key?></dt>
                                                <dd><?=$value?></dd>
                                        <? endforeach; ?>
                </dl>
               
                <form class="form-horizontal" method="post" action="delete.php">
                        <h2>Delete Address</h2>
                    <h3>Are you sure you want to delete <?=$row['address']?> <?=$row['city']?><?=$row['state']?><?=$row['zip_code']?> ?</h3>
                        <input type="hidden" name="id" value="<?=$row['id']?>" />
                    <div class="modal-footer">
                    <input class="btn btn-primary" type="submit" value="Yes" />
                    </div>
                </form>
           </div>
       </div>
</body>
</html>
